# Contributor: mellotron <mellotron@tutanota.com>
# Maintainer:
pkgname=thermald
_pkgname=thermal_daemon
pkgver=2.2
pkgrel=0
pkgdesc="Thermal daemon for IA"
url="https://github.com/01org/thermal_daemon"
arch="all !armhf !armv7 !aarch64 !s390x !mips !mips64"
license="GPL-2.0-or-later"
makedepends="autoconf automake libtool dbus-glib-dev libxml2-dev linux-headers
	autoconf-archive"
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/01org/$_pkgname/archive/v$pkgver.tar.gz
	thermald.initd
	no-werror.patch
	ppc64le.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

package() {
	make DESTDIR="$pkgdir" install
	rm -rf "$pkgdir"/etc/init/ "$pkgdir"/etc/dbus-1

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
}

sha512sums="f2c691061436699aef5bb7d9681370306dc7a64c453208911077c9a4af50e35b32247fc0a35853bb314d0e4289dd07f6116a3ade7fa278b521ed9b7b13db949b  thermald-2.2.tar.gz
ea8964b15fdebc2fb59e93c15b813b93691c2ba01689ac6080f1308a3063b23cba56b4539ccae87575689036f74300a1c22c9b0e77d4ecef9bc08198d7fe4892  thermald.initd
c93c5dd84d175e3fd513c228fdba75cb9e5268dfbc9f6452e407b7e4561ee0a56f49a816378ac7cba9c81cb6f5ad094dff7ac43c9c0e7fa31ad9b5e4894dfc36  no-werror.patch
21168079e65253a1f4b762a1d4114400ff77d658f2f0ad4374f964033b9d8a2ec58ba8e65ca949add02945ba682ce8ff6e65ff27bfac6fa21e2d513c3898af0e  ppc64le.patch"
